home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / misc / gms_dev.lha / GMSDev / Source / C / Fading / GreenFade.c next >
Encoding:
C/C++ Source or Header  |  1998-07-05  |  1.7 KB  |  57 lines

  1. /* Dice: dcc -l0 -mD dpk.o tags.o GreenFade.c -o GreenFade
  2. **
  3. ** Fades into a 32 colour picture.  Then fades up to a specified colour
  4. ** (lime green), and then out to black.  This demo will only work for
  5. ** pictures that make use of a palette table - ie it wouldn't work
  6. ** for a true colour screen.
  7. */
  8.  
  9. #include <proto/dpkernel.h>
  10.  
  11. BYTE *ProgName      = "GreenFade";
  12. BYTE *ProgAuthor    = "Paul Manias";
  13. BYTE *ProgDate      = "January 1998";
  14. BYTE *ProgCopyright = "DreamWorld Productions (c) 1996-1998.  Freely distributable.";
  15. BYTE *ProgShort     = "Demonstration of screen fading.";
  16.  
  17. void main(void)
  18. {
  19.    WORD   FState=0;
  20.    struct GScreen *screen;
  21.    struct Picture *pic;
  22.    struct FileName PicFile = { ID_FILENAME, "GMS:demos/data/PIC.Loading" };
  23.  
  24.    if (pic = Load(&PicFile, ID_PICTURE)) {
  25.       screen = Get(ID_SCREEN);
  26.       CopyStructure(pic,screen);
  27.       screen->Bitmap->Palette = NULL;
  28.       screen->Bitmap->Flags   = BMF_BLANKPALETTE;
  29.  
  30.       if (screen = Init(screen,NULL)) {
  31.          if (Copy(pic->Bitmap,screen->Bitmap) IS ERR_OK) {
  32.  
  33.             Display(screen);
  34.  
  35.             do {
  36.               WaitAVBL();
  37.               FState = ColourToPalette(screen,FState,2,0,screen->Bitmap->AmtColours,pic->Bitmap->Palette+2,0x000000);
  38.             } while (FState != NULL);
  39.  
  40.             do {
  41.               WaitAVBL();
  42.               FState = PaletteToColour(screen,FState,2,0,screen->Bitmap->AmtColours,pic->Bitmap->Palette+2,0xa5f343);
  43.             } while (FState != NULL);
  44.  
  45.             do {
  46.               WaitAVBL();
  47.               FState = ColourMorph(screen,FState,2,0,screen->Bitmap->AmtColours,0xa5f343,0x000000);
  48.             } while (FState != NULL);
  49.  
  50.          }
  51.       Free(screen);
  52.       }
  53.    Free(pic);
  54.    }
  55. }
  56.  
  57.